import java.util.Random;


public class Agent {

	public String name;
	public Agent peer;
	public State nextState;
	public State currentState;
	public State previousState;
	public Role role;
	public Environment environment;
	public Random randomNumberGenerator;
	
	public Agent(String aName, Environment anEnvironment, Role aRole) {
		name = aName;
		environment = anEnvironment;
		currentState = new State();
		role = aRole;
		randomNumberGenerator = new Random();
	}
	
	public void occupySpectrum(Spectrum aSpectrum) {
		currentState.occupiedSpectrum = aSpectrum;
		aSpectrum.occupyingAgents.add(this);
	}
	
	public void vacateSpectrum() {
		currentState.occupiedSpectrum.occupyingAgents.remove(this);
		currentState.occupiedSpectrum = null;
	}
	
	public void adjustPower(int aTransmissionPower) {
		currentState.transmissionPower = aTransmissionPower;
	}
	
	public void turnOffPower() {
		currentState.transmissionPower = 0;
	}
	
}
